﻿using System;

namespace HouseObj
{
    [Serializable]
    /// <summary>
    /// //二手房数据对象
    /// </summary>
    public class MyHouseInfo
    {
        #region Members
        /// <summary>
        /// //二手房编号
        /// </summary>
        public string dataId;
        /// <summary>
        /// //房屋所在小区名称
        /// </summary>
        public string name;
        /// <summary>
        /// //房屋所在城市
        /// </summary>
        public string city;
        /// <summary>
        /// //房屋所在区域
        /// </summary>
        public string region;
        /// <summary>
        /// //简单描述
        /// </summary>
        public string discription;
        /// <summary>
        /// //实景图链接
        /// </summary>
        public string realMapUrl;
        /// <summary>
        /// //户型图链接
        /// </summary>
        public string layoutMapUrl;
        /// <summary>
        /// //房屋详细信息链接
        /// </summary>
        public string detailUrl;
        /// <summary>
        /// //户型配置
        /// </summary>
        public string configuration;
        /// <summary>
        /// //房屋面积大小
        /// </summary>
        public double area;
        /// <summary>
        /// //房屋总价
        /// </summary>
        public double price;
        /// <summary>
        /// //房屋平米价格
        /// </summary>
        public string priceMsg;
        /// <summary>
        /// //看过该房的人数
        /// </summary>
        public int lookedPeopleNum;
        /// <summary>
        /// //网址链接
        /// </summary>
        public string url;
        #endregion

        #region Constructors
        /// <summary>
        /// //构造函数
        /// </summary>
        public MyHouseInfo(string dataId, string name, string city, string region, string discription, string realMapUrl, string layoutMapUrl, string detailUrl, string configuration, string area, string price, string priceMsg, string lookedPeopleNum, string url)
        {
            this.dataId = dataId;
            this.name = name;
            this.city = city;
            this.region = region;
            this.discription = discription;
            this.realMapUrl = realMapUrl;
            this.layoutMapUrl = layoutMapUrl;
            this.detailUrl = detailUrl;
            this.configuration = configuration;
            this.area = area == "" ? 0 : Convert.ToDouble(area);
            this.price = price == "" ? 0 : Convert.ToDouble(price);
            this.priceMsg = priceMsg;
            this.lookedPeopleNum = lookedPeopleNum == "" ? 0 : Convert.ToInt32(lookedPeopleNum);
            this.url = url;
        }
        #endregion

        #region Methods
        /// <summary>
        /// //重载ToString函数
        /// </summary>
        /// <returns>当前对象的字符串</returns>
        public override string ToString()
        {
            string msg = string.Empty;
            msg += "\"" + dataId + "\",";
            msg += "\"" + name + "\",";
            msg += "\"" + city + "\",";
            msg += "\"" + region + "\",";
            msg += "\"" + discription + "\",";
            msg += "\"" + realMapUrl + "\",";
            msg += "\"" + layoutMapUrl + "\",";
            msg += "\"" + detailUrl + "\",";
            msg += "\"" + configuration + "\",";
            msg += area.ToString() + ",";
            msg += price.ToString() + ",";
            msg += "\"" + priceMsg + "\",";
            msg += lookedPeopleNum.ToString() + ",";
            msg += "\"" + url + "\"";
            return msg;
        }
        #endregion
    }
}
